package Util;

import java.util.Random;

public class codeUtils {
    private codeUtils(){

    }
    public static String getCode(){

        Random r=new Random();
        int index=r.nextInt(5);
        char replace=(char)(r.nextInt(10)+48);
        StringBuilder sb=new StringBuilder();
        for(int i=0;i<5;i++){
            if(i==index){
                sb.append(replace);
            }else {
                char a = (char) (r.nextInt(26) + 65);
                char b = (char) (r.nextInt(26) + 97);
                int c = r.nextInt(2);
                if (c == 0) {
                    sb.append(a);
                } else {
                    sb.append(b);
                }
            }
        }
        String str=sb.toString();
//        str.replace(str.charAt(a),b);
        return str;
    }

}
